﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Centny;
namespace Centny.Test
{
    public class TestObj
    {
        public String Title { get; set; }
        public String Des { get; set; }
        public String Image { get; set; }
    }
    public class TestGrp
    {
        public String Title { get; set; }
        public ObservableCollection<GACItem> Objs { get; set; }
        public override string ToString()
        {
            return Title;
        }
    }
    class TestDataSource
    {
        public static String Img1 = "ms-appx:///Assets/1.jpg";
        public static String Img2 = "ms-appx:///Assets/2.jpg";
        public static String Img3 = "ms-appx:///Assets/3.jpg";
        public static String Img4 = "ms-appx:///Assets/4.jpg";
        public static String Img5 = "ms-appx:///Assets/5.jpg";
        public static String Img6 = "ms-appx:///Assets/6.jpg";
        Random rd = new Random();
        public List<Object> RandomTestData(int s)
        {
            List<Object> ds = new List<object>();
            for (int i = 0; i < s; i++)
            {
                TestObj to = new TestObj();
                to.Title = "Title_" + i;
                to.Des = "PM2.5成为中国许多城市特别是大城市最主要的污染物。2011年由于长时间受灰霾的影响，各地公众广泛地关注这个问题，最终PM2.5被纳入空气质量标准检测范围。从2012年开始 ，按照国家的相关要求，一批大型城市开始监测和发布PM2.5的相关信息，对PM2.5的防治取得了历史性的进展。";
                switch (rd.Next(1, 6))
                {
                    case 1:
                        to.Image = Img1;
                        break;
                    case 2:
                        to.Image = Img2;
                        break;
                    case 3:
                        to.Image = Img3;
                        break;
                    case 4:
                        to.Image = Img4;
                        break;
                    case 5:
                        to.Image = Img5;
                        break;
                }
                ds.Add(to);
            }
            return ds;
        }
        public ObservableCollection<TestGrp> RandomTestGrp(int groups, int items)
        {
            ObservableCollection<TestGrp> grps = new ObservableCollection<TestGrp>();
            for (int i = 0; i < groups; i++)
            {
                TestGrp grp = new TestGrp();
                grp.Title = "Group_" + i;
                grp.Objs = new ObservableCollection<GACItem>();
                GACItem item = new GACItem();
                item.RItems = this.RandomTestData(items);
                grp.Objs.Add(item);
                grps.Add(grp);
            }
            return grps;
        }
    }
}
